import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login'
import Layout from '../views/layout'
import home from '../views/layout/home'
import User from '../views/layout/user'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'
  },
  {
    path: '/login',
    component: login
  },
  {
    path: '/layout',
    component: Layout,
    redirect: '/layout/user',
    children: [
      {
        path: 'home',
        component: home
      },
      {
        path: 'user',
        component: User
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
